/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.proxypattern.proxy;

import com.suxiaoxiao.springbootlearn.designpattern.proxypattern.pojo.PersonBean;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 别人的信息
 * 允许修改评分
 * 允许查看信息
 * 不允许修改信息
 *
 * @author zhaorongzhang
 * @version NonOwnerInvocationHandler.java, v 0.1 2020/1/13 12:02 上午 zhaorongzhang Exp $$
 */
public class NonOwnerInvocationHandler extends InvokeMethodConstant {

    public NonOwnerInvocationHandler(PersonBean person) {
        this.person = person;
    }

    @Override
    protected Object getMethodHandler(Method method, Object[] args) throws InvocationTargetException, IllegalAccessException {
        return pass(method, args);
    }

    @Override
    protected Object setRatingMethodHandler(Method method, Object[] args) throws InvocationTargetException, IllegalAccessException {
        return pass(method, args);
    }

    @Override
    protected Object setMethodHandler(Method method, Object[] args) throws IllegalAccessException {
        return notPass();
    }

}